package com.company.finance.ddd.domain.core.bill.enums;

import lombok.ToString;

import java.text.MessageFormat;

/**
 * @author wanglei
 */
@ToString
public enum BillSubTypeEnum {

    /**
     *
     */
    FINGER("FINGER", "指尖报销单"),
    SUPPLIER_EXPENSE("RPT001", "供应商报账单"),
    PURCHASE_EXPENSE("RPT015", "采购报账单"),
    RELATED_TRANSACTION("GLJY", "关联交易采购申请单"),
    PURCHASE_PAYMENT("RPT016", "采购付款单");

    public String subTypeCode;
    public String subTypeName;

    BillSubTypeEnum(String subTypeCode, String subTypeName) {
        this.subTypeCode = subTypeCode;
        this.subTypeName = subTypeName;
    }

    public static BillSubTypeEnum getBillSubTypeEnum(String subTypeCode) {
        for (BillSubTypeEnum billSubTypeEnum : values()) {
            if (billSubTypeEnum.subTypeCode.equals(subTypeCode)) {
                return billSubTypeEnum;
            }
        }
        throw new RuntimeException(MessageFormat.format("Can not get BillSubTypeEnum by subTypeCode[{0}]", subTypeCode));
    }
}
